﻿using System.Collections;

namespace Medianamik.Core.DAL
{
    public abstract class BaseSqlSequentialGenerator : IEnumerator 
    {
        private int _count;
        protected abstract string NamePrefix
        {
            get;
        }
        #region IEnumerator<string> Members

        public virtual string Current
        {
            get { return NamePrefix + _count; }
        }

        #endregion

        #region IDisposable Members

        public virtual void Dispose()
        {

        }

        #endregion

        #region IEnumerator Members

        object System.Collections.IEnumerator.Current
        {
            get { return Current; }
        }

        public virtual bool MoveNext()
        {
            _count++; return true;
        }

        public virtual void Reset()
        {
            _count = 0;
        }

        #endregion

        public virtual string Next()
        {
            MoveNext();
            return Current;
        }
    }
}
